﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace HackApp.DataAccess
{
  /// <summary>
  /// Interface for a generic repository containing definitions for basic CRUD operations
  /// </summary>
  /// <typeparam name="TEntity">The generic type representing any class
  /// Can be changed to inherit from a specific class for custom generic repositories
  /// </typeparam>
  public interface IGenericRepository<TEntity> where TEntity : class
  {
    IEnumerable<TEntity> Get(Expression<Func<TEntity, bool>> filter = null,
        Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
        string includeProperties = "");

    TEntity GetByID(object id);

    void Insert(TEntity entity);

    void Delete(object id);

    void Delete(TEntity entityToDelete);

    void Update(TEntity entityToUpdate);
  }
}
